package com.aholu.dao;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import org.hibernate.Transaction;

import com.aholu.model.User;

/**
 * 
 * @author aholu
 *
 */
public class UserDao extends GenericDaoImpl<User, Serializable> {

	
	public User findByUserName(String username) {
		User ex = new User();
		ex.setUserName(username);
		return findByExample(ex).get(0);

	}
	
	public User findByUserNameAndPass(String username, String password){
		
		User user = new User();
		user.setUserName(username);
		user.setPassword(password);
		List<User> list = findByExample(user);
		if(list== null||list.isEmpty()){
			return null;
		}else{
			return list.get(0);

		}
		
	}
	
}
